#pragma once
#include <glm/glm.hpp>


namespace mgl{

struct Camera{

	Camera(const glm::vec3& position, const glm::vec3& look, const glm::vec3& up, float fov, int width, int height, float nearClip, float farClip);

	const glm::mat4& getMVP(const glm::mat4& modelMat);
	const glm::mat4& getMV(const glm::mat4& modelMat);
	const glm::vec3& getPosition()const{ return m_position; }

	void rotate(const glm::vec3& axis, float radian);
	void move(const glm::vec3& direction, float distance);
	void resize(int width, int heigt);

	const glm::vec3& getLook()const{ return m_look;}
	const glm::vec3& getRight()const{ return m_right;}

private:

	void update();

	glm::vec3 m_position;
	glm::vec3 m_look;
	glm::vec3 m_up;
	glm::vec3 m_right;

	int m_width;
	int m_height;
	float m_fov;
	float m_near;
	float m_far;

	glm::mat4 m_view;
	glm::mat4 m_persp;
	glm::mat4 m_mvp;
	glm::mat4 m_mv;

};

}